#!/bin/sh
app_name=WebManage
deploy_path="/opt/$app_name"
echo $deploy_path
target_ip=10.10.2.21
sshpass -p 123456 ssh root@$target_ip "$deploy_path/bin/$app_name stop"
sshpass -p 123456 ssh root@$target_ip "rm -rf $deploy_path"

cd ../../UMessage/trunk
./build.sh

cd ../../$app_name/trunk

pwd

svn up
mvn clean package -Dmaven.test.skip=true
chmod 755 target/jsw/$app_name/bin/*
echo "start deploy"
sshpass -p 123456 scp -r target/jsw/$app_name root@$target_ip:/opt/$app_name
echo "deploy done, starting service: $app_name"
sshpass -p 123456 ssh root@$target_ip "source /etc/profile;cd /opt/$app_name;bin/$app_name start"
sshpass -p 123456 ssh root@$target_ip "source /etc/profile; cd /opt/$app_name;bin/$app_name status"
mvn clean
echo "build space cleaned"
